<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: stefanfrings::HttpResponse Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classstefanfrings_1_1HttpResponse.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classstefanfrings_1_1HttpResponse-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">stefanfrings::HttpResponse Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>This object represents a HTTP response, used to return something to the web client.  
 <a href="classstefanfrings_1_1HttpResponse.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="httpresponse_8h_source.html">httpresponse.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a97dd17f92a23d9725330978e32cec8d5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a97dd17f92a23d9725330978e32cec8d5">HttpResponse</a> (QTcpSocket *socket)</td></tr>
<tr class="memdesc:a97dd17f92a23d9725330978e32cec8d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="classstefanfrings_1_1HttpResponse.html#a97dd17f92a23d9725330978e32cec8d5">More...</a><br /></td></tr>
<tr class="separator:a97dd17f92a23d9725330978e32cec8d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a189c27096844347bc73bf6f001137455"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a189c27096844347bc73bf6f001137455">setHeader</a> (const QByteArray name, const QByteArray value)</td></tr>
<tr class="memdesc:a189c27096844347bc73bf6f001137455"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a HTTP response header.  <a href="classstefanfrings_1_1HttpResponse.html#a189c27096844347bc73bf6f001137455">More...</a><br /></td></tr>
<tr class="separator:a189c27096844347bc73bf6f001137455"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a885ce9487f4d76775d1578ad92cdf517"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a885ce9487f4d76775d1578ad92cdf517">setHeader</a> (const QByteArray name, const int value)</td></tr>
<tr class="memdesc:a885ce9487f4d76775d1578ad92cdf517"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a HTTP response header.  <a href="classstefanfrings_1_1HttpResponse.html#a885ce9487f4d76775d1578ad92cdf517">More...</a><br /></td></tr>
<tr class="separator:a885ce9487f4d76775d1578ad92cdf517"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aade61e2cccc871b06e7a3df86bf15d69"><td class="memItemLeft" align="right" valign="top"><a id="aade61e2cccc871b06e7a3df86bf15d69"></a>
QMap&lt; QByteArray, QByteArray &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#aade61e2cccc871b06e7a3df86bf15d69">getHeaders</a> ()</td></tr>
<tr class="memdesc:aade61e2cccc871b06e7a3df86bf15d69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the map of HTTP response headers. <br /></td></tr>
<tr class="separator:aade61e2cccc871b06e7a3df86bf15d69"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1bcd416f520020e944900e35ab51864c"><td class="memItemLeft" align="right" valign="top"><a id="a1bcd416f520020e944900e35ab51864c"></a>
QMap&lt; QByteArray, <a class="el" href="classstefanfrings_1_1HttpCookie.html">HttpCookie</a> &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a1bcd416f520020e944900e35ab51864c">getCookies</a> ()</td></tr>
<tr class="memdesc:a1bcd416f520020e944900e35ab51864c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the map of cookies. <br /></td></tr>
<tr class="separator:a1bcd416f520020e944900e35ab51864c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5801dc0744a388de556f08369e7b68bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a5801dc0744a388de556f08369e7b68bf">setStatus</a> (const int statusCode, const QByteArray description=QByteArray())</td></tr>
<tr class="memdesc:a5801dc0744a388de556f08369e7b68bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set status code and description.  <a href="classstefanfrings_1_1HttpResponse.html#a5801dc0744a388de556f08369e7b68bf">More...</a><br /></td></tr>
<tr class="separator:a5801dc0744a388de556f08369e7b68bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b73cdd0d5139fb33b9713f6035c2d27"><td class="memItemLeft" align="right" valign="top"><a id="a3b73cdd0d5139fb33b9713f6035c2d27"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a3b73cdd0d5139fb33b9713f6035c2d27">getStatusCode</a> () const</td></tr>
<tr class="memdesc:a3b73cdd0d5139fb33b9713f6035c2d27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the status code. <br /></td></tr>
<tr class="separator:a3b73cdd0d5139fb33b9713f6035c2d27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab3178a5e9ccf6223a5218650076d3bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf">write</a> (const QByteArray data, const bool lastPart=false)</td></tr>
<tr class="memdesc:aab3178a5e9ccf6223a5218650076d3bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write body data to the socket.  <a href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf">More...</a><br /></td></tr>
<tr class="separator:aab3178a5e9ccf6223a5218650076d3bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0036711cc0e5273754cdf3fc3dcd2b0e"><td class="memItemLeft" align="right" valign="top"><a id="a0036711cc0e5273754cdf3fc3dcd2b0e"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a0036711cc0e5273754cdf3fc3dcd2b0e">hasSentLastPart</a> () const</td></tr>
<tr class="memdesc:a0036711cc0e5273754cdf3fc3dcd2b0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Indicates whether the body has been sent completely (<a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a> has been called with lastPart=true). <br /></td></tr>
<tr class="separator:a0036711cc0e5273754cdf3fc3dcd2b0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac32c7fcc332d3f834ec88ae06b2e7d63"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#ac32c7fcc332d3f834ec88ae06b2e7d63">setCookie</a> (const <a class="el" href="classstefanfrings_1_1HttpCookie.html">HttpCookie</a> &amp;cookie)</td></tr>
<tr class="memdesc:ac32c7fcc332d3f834ec88ae06b2e7d63"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a cookie.  <a href="classstefanfrings_1_1HttpResponse.html#ac32c7fcc332d3f834ec88ae06b2e7d63">More...</a><br /></td></tr>
<tr class="separator:ac32c7fcc332d3f834ec88ae06b2e7d63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb4d442dd120b515d472aff13074275a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#afb4d442dd120b515d472aff13074275a">redirect</a> (const QByteArray &amp;url)</td></tr>
<tr class="memdesc:afb4d442dd120b515d472aff13074275a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a redirect response to the browser.  <a href="classstefanfrings_1_1HttpResponse.html#afb4d442dd120b515d472aff13074275a">More...</a><br /></td></tr>
<tr class="separator:afb4d442dd120b515d472aff13074275a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d50597cae5e04e6b2110df589c6617e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a0d50597cae5e04e6b2110df589c6617e">flush</a> ()</td></tr>
<tr class="memdesc:a0d50597cae5e04e6b2110df589c6617e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flush the output buffer (of the underlying socket).  <a href="classstefanfrings_1_1HttpResponse.html#a0d50597cae5e04e6b2110df589c6617e">More...</a><br /></td></tr>
<tr class="separator:a0d50597cae5e04e6b2110df589c6617e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1869ed834437286ba88ab72027d12463"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpResponse.html#a1869ed834437286ba88ab72027d12463">isConnected</a> () const</td></tr>
<tr class="memdesc:a1869ed834437286ba88ab72027d12463"><td class="mdescLeft">&#160;</td><td class="mdescRight">May be used to check whether the connection to the web client has been lost.  <a href="classstefanfrings_1_1HttpResponse.html#a1869ed834437286ba88ab72027d12463">More...</a><br /></td></tr>
<tr class="separator:a1869ed834437286ba88ab72027d12463"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This object represents a HTTP response, used to return something to the web client. </p>
<p><code></p><pre>
  response.setStatus(200,"OK"); // optional, because this is the default
  response.writeBody("Hello");
  response.writeBody("World!",true);
</pre><p></code> </p>
<p>Example how to return an error: <code></p><pre>
  response.setStatus(500,"server error");
  response.write("The request cannot be processed because the servers is broken",true);
</pre><p></code> </p>
<p>In case of large responses (e.g. file downloads), a Content-Length header should be set before calling <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. Web Browsers use that information to display a progress bar. </p>

<p class="definition">Definition at line <a class="el" href="httpresponse_8h_source.html#l00036">36</a> of file <a class="el" href="httpresponse_8h_source.html">httpresponse.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a97dd17f92a23d9725330978e32cec8d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97dd17f92a23d9725330978e32cec8d5">&#9670;&nbsp;</a></span>HttpResponse()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HttpResponse::HttpResponse </td>
          <td>(</td>
          <td class="paramtype">QTcpSocket *&#160;</td>
          <td class="paramname"><em>socket</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">socket</td><td>used to write the response </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00010">10</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a0d50597cae5e04e6b2110df589c6617e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d50597cae5e04e6b2110df589c6617e">&#9670;&nbsp;</a></span>flush()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::flush </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Flush the output buffer (of the underlying socket). </p>
<p>You normally don't need to call this method because flush is automatically called after <a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a0a7210907152c46b8b5a47feb64cf6bd" title="Generate a response for an incoming HTTP request.">HttpRequestHandler::service()</a> returns. </p>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00192">192</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="a1869ed834437286ba88ab72027d12463"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1869ed834437286ba88ab72027d12463">&#9670;&nbsp;</a></span>isConnected()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool HttpResponse::isConnected </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>May be used to check whether the connection to the web client has been lost. </p>
<p>This might be useful to cancel the generation of large or slow responses. </p>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00198">198</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="afb4d442dd120b515d472aff13074275a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb4d442dd120b515d472aff13074275a">&#9670;&nbsp;</a></span>redirect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::redirect </td>
          <td>(</td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>url</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a redirect response to the browser. </p>
<p>Cannot be combined with <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">url</td><td>Destination URL </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00184">184</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="ac32c7fcc332d3f834ec88ae06b2e7d63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac32c7fcc332d3f834ec88ae06b2e7d63">&#9670;&nbsp;</a></span>setCookie()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::setCookie </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classstefanfrings_1_1HttpCookie.html">HttpCookie</a> &amp;&#160;</td>
          <td class="paramname"><em>cookie</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a cookie. </p>
<p>You must call this method before the first <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. </p>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00168">168</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="a885ce9487f4d76775d1578ad92cdf517"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a885ce9487f4d76775d1578ad92cdf517">&#9670;&nbsp;</a></span>setHeader() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::setHeader </td>
          <td>(</td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const int&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a HTTP response header. </p>
<p>You must call this method before the first <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>name of the header </td></tr>
    <tr><td class="paramname">value</td><td>value of the header </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00026">26</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="a189c27096844347bc73bf6f001137455"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a189c27096844347bc73bf6f001137455">&#9670;&nbsp;</a></span>setHeader() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::setHeader </td>
          <td>(</td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a HTTP response header. </p>
<p>You must call this method before the first <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>name of the header </td></tr>
    <tr><td class="paramname">value</td><td>value of the header </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00020">20</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="a5801dc0744a388de556f08369e7b68bf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5801dc0744a388de556f08369e7b68bf">&#9670;&nbsp;</a></span>setStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::setStatus </td>
          <td>(</td>
          <td class="paramtype">const int&#160;</td>
          <td class="paramname"><em>statusCode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>description</em> = <code>QByteArray()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set status code and description. </p>
<p>The default is 200,OK. You must call this method before the first <a class="el" href="classstefanfrings_1_1HttpResponse.html#aab3178a5e9ccf6223a5218650076d3bf" title="Write body data to the socket.">write()</a>. </p>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00037">37</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<a id="aab3178a5e9ccf6223a5218650076d3bf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aab3178a5e9ccf6223a5218650076d3bf">&#9670;&nbsp;</a></span>write()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HttpResponse::write </td>
          <td>(</td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const bool&#160;</td>
          <td class="paramname"><em>lastPart</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write body data to the socket. </p>
<p>The HTTP status line, headers and cookies are sent automatically before the body. </p>
<p>If the response contains only a single chunk (indicated by lastPart=true), then a Content-Length header is automatically set. </p>
<p>Chunked mode is automatically selected if there is no Content-Length header and also no Connection:close header. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>Data bytes of the body </td></tr>
    <tr><td class="paramname">lastPart</td><td>Indicates that this is the last chunk of data and flushes the output buffer. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpresponse_8cpp_source.html#l00099">99</a> of file <a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>httpserver/<a class="el" href="httpresponse_8h_source.html">httpresponse.h</a></li>
<li>httpserver/<a class="el" href="httpresponse_8cpp_source.html">httpresponse.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>stefanfrings</b></li><li class="navelem"><a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
